package com.atguigu.gmall.list.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.list.client.impl.ServiceListClientFallback;
import com.atguigu.gmall.model.list.SearchParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 远程调用 feign client es数据处理接口
 *
 * @author : zjj
 * @date : 2021/2/2 14:46
 */
@FeignClient(value = "service-list",fallback = ServiceListClientFallback.class)
public interface ServiceListClient {

    /**
     * 热度排名
     *
     * @param skuId skuId
     * @return      处理结果
     */
    @GetMapping("api/list/inner/incrHotScore/{skuId}")
    Result incrHotScore(@PathVariable Long skuId);


    /**
     * 搜索商品
     * @param listParam 商品过滤参数
     * @return          商品信息
     */
    @PostMapping("/api/list")
    Result list(@RequestBody SearchParam listParam);

    /**
     * 上架商品
     * @param skuId skuId
     * @return      处理结果
     */
    @GetMapping("/api/list/inner/upperGoods/{skuId}")
    Result upperGoods(@PathVariable("skuId") Long skuId);

    /**
     * 下架商品
     * @param skuId skuId
     * @return      处理结果
     */
    @GetMapping("/api/list/inner/lowerGoods/{skuId}")
    Result lowerGoods(@PathVariable("skuId") Long skuId);
}
